﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace Kamikaze
{
    class Creditos : SceneBase
    {
        Texture2D creditos;

        MouseState mouse, oldMouse;
        AnimatedObject botaoVoltar2;




        public override void start()
        {

            Game1.Self.IsMouseVisible = true;
            creditos = (Game1.Self.Content.Load<Texture2D>(@"Imagens/Creditos"));


            Kamikaze.AnimatedObject.AnimationStructure animationVoltar2 = new Kamikaze.AnimatedObject.AnimationStructure();
            animationVoltar2.frameCount = 1;
            animationVoltar2.frameWidth = 135;
            animationVoltar2.frameHeight = 37;
            animationVoltar2.framePerSecond = 1;
            animationVoltar2.X = 135 * 1;
            animationVoltar2.Y = 0;


            botaoVoltar2 = new AnimatedObject(Game1.Self.Content.Load<Texture2D>(@"Imagens/voltar"), 135, 36);
            botaoVoltar2.posicao.Y = 300;
            botaoVoltar2.posicao.X = 500;
            botaoVoltar2.listaAnimations.Add("voltar2", animationVoltar2);


        }

        public override void update(GameTime gameTime)
        {
            oldMouse = mouse;
            mouse = Mouse.GetState();
           
            botaoVoltar2.calcularRetangulo();
            botaoVoltar2.Update(gameTime);


            if (botaoVoltar2.collisionBounds.Contains(mouse.X, mouse.Y))
            {


                botaoVoltar2.ChangeAnimation("voltar2");



            }
            else
            {


                botaoVoltar2.ChangeAnimation("default");
            }



            if (mouse.LeftButton == ButtonState.Pressed && oldMouse != mouse)
            {
                if (botaoVoltar2.collisionBounds.Contains(mouse.X, mouse.Y))
                {
                    SceneManager.setScene(new Menu());
                }
            }


        


        }


        public override void draw(SpriteBatch spriteBatch)
        {



            spriteBatch.Draw(creditos, new Vector2(0, 0), Color.White);
            botaoVoltar2.Draw(spriteBatch);
        }

        public override void terminate()
        {

        }








    }
}
